package com.example.ivory.accountbook.packetActivity;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

import com.example.ivory.accountbook.Activity.Activity_main;
import com.example.ivory.accountbook.R;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by 鐜嬪姊� on 2016/8/27.
 */
public class inpacketActivity extends Activity {
    //鐣岄潰瀛樺湪鐨勪竴浜涙帶浠�
    private Button backBt;
    private Button setBt;
    private TextView txtPacketName;
    private TextView txtPacketBalance;

    //褰撳墠椤甸潰鐨勪俊鎭�
    private static Map<String,Object> message=new HashMap<String, Object>();


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_inpacket);

        //缁戝畾鐣岄潰涓婄殑鎺т欢
        backBt= (Button) findViewById(R.id.buttonBackPacket);
        setBt= (Button) findViewById(R.id.buttonSetPacket);
        txtPacketName= (TextView) findViewById(R.id.textviewPacketName);
        txtPacketBalance= (TextView) findViewById(R.id.textviewPacketBalance);

        //鐩戝惉閫�鍥炴寜閽�
        backBt.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                finish();
            }
        });

        //鐩戝惉璁剧疆鎸夐挳
        setBt.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                startActivity(new Intent(inpacketActivity.this,setpacketActivity.class));
                finish();
            }
        });

        //鑾峰彇璺宠浆鐨勪俊鎭�
        Intent getIntent=this.getIntent();

        txtPacketName.setText(getIntent.getStringExtra("name"));
        txtPacketBalance.setText(getIntent.getStringExtra("money"));

        /*message.put("name",getIntent.getStringExtra("name"));
        message.put("money",getIntent.getStringExtra("money"));*/

    }

    public void showTxt(){
        txtPacketName.setText(message.get("name").toString());
        txtPacketBalance.setText(message.get("money").toString());
    }
}
